import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { DelDataButton, OpenExcelButton, OpenTwoRouter } from '../Common/options'

export const NewSciencesA01 = async ({ url, OptionsEvent, ClientData, Permission, actionRef }) => {
    let data = {
        pageSize: 10,
        params: { pageIndex: 1, InfoTypeUuid: '1154691c-a87d-40e5-9a33-946fb0bc1001' },
        get: API_LIST()[`getNewSciences`],
        added: `posNewSciences`,
        modify: `putNewSciences`,
        delete: `delNewSciences`,
        options: [
            <OpenExcelButton
                key="two"
                title="批量导入"
                OptionsEvent={OptionsEvent}
                data={{
                    save: true,
                    submit: true,
                    url: 'getNewScienceExcel',
                    pos: 'posNewScienceExcel',
                    InfoTypeUuid: '1154691c-a87d-40e5-9a33-946fb0bc1001',
                }}
            />,
        ],
        columns: [
            { ...commonTableList.SearchSort, selectType: 'NewSciencesA01' },
            commonTableList.uuid,
            { ...commonTableList.tableName, title: '获奖项目', width: 300 },
            { ...commonTableList.fullName, title: '奖项名称' },
            // { ...commonTableList.organizationUuid, valueEnum: ClientData.organization ,title:'项目经理' },
            {
                dataIndex: 'value1',
                title: '项目经理',
                valueType: 'input',
                ellipsis: true,
                width: 200,
            },
            {
                dataIndex: 'value2',
                title: '奖励单位',
                valueType: 'input',
                ellipsis: true,
                width: 200,
                hideInSearch: true,
            },
            {
                dataIndex: 'value3',
                title: '文件号',
                valueType: 'input',
                ellipsis: true,
                width: 200,
                hideInSearch: true,
            },
            {
                dataIndex: 'eventDate1',
                title: '奖励时间',
                valueType: 'Date',
                ellipsis: true,
                width: 150,
                hideInSearch: true,
            },
            {
                dataIndex: 'value4',
                title: '牵头单位',
                valueType: 'input',
                ellipsis: true,
                width: 200,
                hideInSearch: true,
            },
            commonTableList.remark,
            commonTableList.BeginSecurityDate,
            commonTableList.EndSecurityDate,
            commonTableList.updateUserName,
            commonTableList.updateTime,
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 240,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        <OpenExcelButton
                            key="two"
                            title="修改"
                            OptionsEvent={OptionsEvent}
                            data={{
                                save: true,
                                submit: true,
                                url: 'getNewScienceExcel',
                                pos: 'posNewScienceExcel',
                                InfoTypeUuid: '1154691c-a87d-40e5-9a33-946fb0bc1001',
                                uuid: record.uuid,
                            }}
                        />,
                        <OpenTwoRouter
                            key="TwoTwo"
                            title="附件管理"
                            twoTitle="优质工程附件信息"
                            modal="TableList"
                            OptionsEvent={OptionsEvent}
                            other={{
                                page: 'AttachmentDetails',
                                actionRef,
                                Permission,
                                oneData: record,
                                header: data.columns,
                            }}
                        />,
                        <DelDataButton
                            OptionsEvent={OptionsEvent}
                            key="del"
                            title="删除"
                            url="NewSciences"
                            uuid={record.uuid}
                        />,
                    ]
                },
            },
        ],
    }

    return data
}
